import Types from '../actionTypes';

import {
  getAllBrand,
  getGoodsLibraryData,
  seachGoodsData
} from '../../api';

// 一层

const GET_GOODSLIBRARY_INFO = (page = 1, page_size = 10) => {
  return new Promise((resolve, reject) => {
    getGoodsLibraryData({page, page_size})
      .then(res => {
        console.log(res);
        resolve({
          type: Types.GET_GOODSLIBRARY_INFO,
          data: res
        });
      })
      .catch(err => {
        console.log(err);
      });
  });

};
// seachGoodsData
const SEACH_GOODS_DATA = params => {
  return new Promise((resolve, reject) => {
    seachGoodsData(params)
      .then(res => {
        resolve({
          type: Types.GET_GOODSLIBRARY_INFO,
          data: res
        });
      })
      .catch(err => {
        console.log(err);
      });
  });
};

export default {
  GET_GOODSLIBRARY_INFO,
  SEACH_GOODS_DATA
};
